﻿using System;
using Gtk; // 引入GTK#命名空间
 
public class HelloGtkSharp : Window
{
    public HelloGtkSharp() : base("Hello GTK#")
    {
        // 创建一个按钮并设置标签
        Button button = new Button("Click me!");
        button.Clicked += (sender, e) => {
            Console.WriteLine("Button was clicked!");
        };

        // 将按钮添加到窗口中
        this.Add(button);
    }

    protected override bool OnDeleteEvent(Gdk.Event args)
    {
        Application.Quit();
        return true;
    }
}

class Program
{
    [STAThread]
    static void Main(string[] args)
    {
        Application.Init();
        HelloGtkSharp win = new HelloGtkSharp();
        win.Show();
        Application.Run();
    }
}
